<?php
define('EmpireCMSAdmin','1');
require_once("../e/class/connect.php");
require_once("../e/class/db_sql.php");
require_once("../e/class/functions.php");
require_once("../e/class/user.php");
require_once("../e/class/say.php");
require_once("../e/class/page_obj.php");
$link=db_connect();
$empire=new mysqlquery();
$header=DbTouch("phome_enewstempvar",array("varid"=>1));
$linkArrr=array("t"=>1);
$classid=69;
$db="phome_ecms_tribe";
$LinkArr=array("全部","登山","徒步","野营","自驾","滑雪","环保公益","户外体育","聚会");

$TypeArr=array("全部","自由群体","高校户外","俱乐部","兴趣小组","环保公益","其他");
$DTArr=array("全部","自由群体","高校","俱乐部","环保公益");
$p=$_REQUEST['p'];
$arr=$_GET;
$tag=$arr["tg"]!=0?$LinkArr[$arr["tg"]]:"";
if($arr["t"]){$cA["type"]=$tag;}
$lmt=$arr["tg"]?" AND instr( tags, '".($tag)."') ":"";
$lmt.=$arr["t"]?" AND type ={$arr['t']} ":"";//type
$cA=array("status"=>1);

if($arr["tg"]){$other=" AND instr( tags, '".($tag)."')";}
$nums=DbTouch($db,$cA,"count(*) as total",$lmt);
$page=new page_obj($p,array("itemnum"=>10,"border"=>4,"row_count"=>$nums['total']));
$limit_str=$page->get_limit_str();
$list=DbTouchAll($db,array("status"=>1),"*","".$lmt.$limit_str);
$linkString='';

foreach($LinkArr as $k=>$v){	
	$a=array("tg"=>($k));	
	if($_GET['t']){$a['t']=$_GET['t'];}							
	if(urldecode($arr[tg])==$k || ($k==0 && empty($_GET['tg']))){
		$linkString.= "<li><b>&gt;{$v}</b></li>";
	}else{
		if($k!=0){
			$linkString= $linkString."<li><a href=".$_SERVER["SCRIPT_URI"]."?".http_build_query($a).">{$v}</a></li>";
		}else{
			$linkString= $linkString."<li><a href=".$_SERVER["SCRIPT_URI"].">{$v}</a></li>";
		}
	}
}
$typeString="";
$tc=$_GET['t'];
foreach($DTArr as $tk=>$tv){	
	if($_GET['tg']){
		$t['tg']=$_GET['tg'];			
	}
	$t["t"]=$tk;
	if($tk==$tc){
		$typeString.= "<b style='padding-right:10px;'>{$tv}</b>";
	}else{
		if($tk!=0){
			$typeString= $typeString."<a href=".$_SERVER["SCRIPT_URI"]."?".http_build_query($t).">{$tv}</a>";
		}else{
			$typeString= $typeString."<a href=".$_SERVER["SCRIPT_URI"].">{$tv}</a>";
		}
	}
}
$page_list=$page->build_html_link("p");
$goodList=DbTouchAll("phome_ecms_actives",array("checked"=>1,"isgood"=>1),"*","limit 3");
$newList=DbTouchAll($db,array("status"=>1),"*"," order by truetime limit 4");
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <title>圈子列表</title>
    <link href="<?=$public_r['newsurl']?>/skin/default/css/global.css" rel="stylesheet" type="text/css" />
	<link href="<?=$public_r['newsurl']?>/skin/default/css/news.css" rel="stylesheet" type="text/css" />
	<script language="javascript" type="text/javascript" src="<?=$public_r['newsurl']?>/skin/default/js/jquery-1.4.4.min.js"></script>
	<script language="javascript" type="text/javascript" src="<?=$public_r['newsurl']?>/skin/default/js/global.js"></script>
	<script language="javascript" type="text/javascript" src="<?=$public_r['newsurl']?>/skin/default/js/city_select.js"></script>
<script language="javascript" type="text/javascript" src="<?=$public_r['newsurl']?>/skin/default/js/ajaxupload.js"></script>
	<script language="javascript" type="text/javascript" src="<?=$public_r['newsurl']?>/skin/default/js/tribe_list.js"></script>	
</head>
<body>
<div id='user_message'><a href=''>您有2条新的消息</a></div>
<input type="hidden" id='newsurl' value="<?=$public_r['newsurl']?>" />
<input type="hidden" id='classid' value="<?=$classid?>" />
<input type="hidden" id='addtribeid' value="" />
<div class="popup-box" style="z-index:5000;display:none;">
	<table style="border:1px solid #999999;" cellspacing="0" cellpadding="0">
		<tr style="border:1px solid #999999;padding:0px;background:#2E80B2;"><td style="padding:0px;">		
			<div class="popup-top">
				<a class="popup-close" href="javascript:void(0);" onclick="popup_close();">&nbsp;</a>
				<div class="popup-title">发布预测</div>
			</div>
			</td></tr>

		<tr><td>
			<div class="popup-body"></div>
			<div class="popup-loading">加载中...</div>
		</td></tr>
	</table>
</div>
<div id="header">

 <div id="menus">
<?=str_replace('[!--news.url--]',$public_r[newsurl],$header['varvalue']);?>
 </div>
 <div style='border:'></div>
<form action="<?=$public_r['newsurl']?>e/search/" method="post" class="search-frm" method="get">
<input type="hidden" name="searchget" value="2" />
<input type="hidden" name="tempid" value="1"/>
<input type="hidden" name="andor" value="and"/>
<input type="hidden" name="hh" value="LIKE,EQ,GE,LE,EQ"/>
<input type="hidden" name="tbname" value="tribe"/>
<input type="hidden" name="show" value="title,start_city,start_time,end_time,active_type">
<input type="hidden" name="keyboard" class="search-keyboard" value="">
 <div id="city">
   <div class="hand"><a href="javascript:setupTribe();"><img src="<?=$public_r['newsurl']?>/skin/default/pic/create.jpg" alt="" title="" /></a></div>

   <p style="margin-top:20px;margin-left:50px;">部落搜索：<input type="text" class="text long search-title" style="width:300px;"/><input type="submit" onclick="newMoveSubmit();" class="btn" value="搜索" /></p>
 </div>
</form>
</div>
<div id="main">
 <div id="mainborder">
   <div id="leftcontent">
     <div class="content">
       <div class="title title1"><h3>活动分类</h3></div>
       <div class="body">
         <ul class="category">
         <?=$linkString?>
         </ul>
       </div>
       <div class="bottom"></div>
     </div>
   </div>
   <div id="midcontent">
   <div class="content">
       <div class="title title1">
		<div class="t_r">
			<?=$typeString?>
			<select class='orderby-select'>
				<option value='<?php $_GET['o']='c';  echo $_SERVER["SCRIPT_URI"]."?".http_build_query($_GET);?>'>部落活跃度</option>
				<option value='<?php $_GET['o']='m';  echo $_SERVER["SCRIPT_URI"]."?".http_build_query($_GET);?>'>部落人数</option>
				<option value='<?php $_GET['o']='t';  echo $_SERVER["SCRIPT_URI"]."?".http_build_query($_GET);?>'>创建时间</option>
				<option value='<?php $_GET['o']='tp';  echo $_SERVER["SCRIPT_URI"]."?".http_build_query($_GET);?>'>主题数</option>
			</select>
		</div>
		<h3>野人部落</h3></div>
       <div class="body">
          <ul class="activity">
		 <?php 
		 if($list){
			$index=0;
			foreach($list as $lk=>$lv){
			$U=getUserInfo($lv['userid']);
		 ?>
             <li<?=$index++%2==1?" class='li'":""?>>
               <div class="image"><a href="<?=$lv['title']?>"><img title="<?=$lv['title']?>" alt="<?=$lv['title']?>" src="<?=$public_r["newsurl"].($lv['cover_url']?$lv['cover_url']:"images/img01.jpg")?>"></a></div>
               <dl>
                  <dt><a href="<?php echo $public_r['newsurl']."tribe/detail/?id=".$lv['id'];?>"><?=$lv['title']?></a></dt>
                  <dd>
                     <p>发 起 人：<a href="<?=$public_r['newsurl']?>e/member/sp/?uid=<?=$lv[userid]?>"><?=$U['nickname']?></a></p>
                     <p>活动分类：<?=$TypeArr[$lv['type']]?></p>
                     <p>部落地域：<?=$lv['province']?$lv['province']." : ".$lv['city']:""?></p>
                     <p>部落标签：<?=$lv['tags']?></p>
                     
                  </dd>
               </dl>
               <div class="clear"></div>
             </li>
		<?php 
			
		}
		}else{?>
		<li><div class="no-data">暂无相关数据！</div></li>
		<?php }?>
          </ul>
          <div class="page" style="height:30px;"><?=$page_list?></div>
       </div>
       <div class="bottom"></div>
     </div>
   </div>
   <div id="rightcontent">
     <div class="content">
       <div class="title title1"><a class="more" href="#" style="display:none;">+更多</a><h3>圈子最新话题</h3></div>
       <div class="body">
         <ul class="news">
            <li><a href="#">游泳圈新人报道贴</a></li>
            <li><a href="#">建议在韩队无法带队的情况下</a></li>
            <li><a href="#">攀爬野长城，保护还是伤害？</a></li>
            <li><a href="#">搞个活动吧 都加入了 就是没有...</a></li>
            <li><a href="#">【我爱长城】之北京地区长城...</a></li>  
            <li><a href="#">新驴老驴报道专用贴-----来说...</a></li>
            <li><a href="#">俺近期习惯给人推荐的单</a></li>
            <li><a href="#">定风波 风雪游陈家堡长...</a></li>
            <li><a href="#">2011春季纯粹户外AA活动...</a></li>         
            <li><a href="#">好久没来了</a></li>
         </ul>
       </div>
       <div class="bottom"></div>
     </div>
      <div class="content">
       <div class="title"><a class="more" href="<?php $_GET['o']='c';  echo $_SERVER["SCRIPT_URI"]."?o=t"?>">+更多</a><h3>最新创建部落</h3></div>
       <div class="body">
         <ul class="part">
		 <?php if($newList){
			 
			 foreach($newList as $key=>$value){
					$U=getUserInfo($value['userid']);
				 ?>
            <li>
             <a href="<?php echo $public_r['newsurl']."tribe/detail/?id=".$value['id'];?>"><img title="<?=$value['title']?>" alt="<?=$value['title']?>" src="<?=$public_r["newsurl"].($value['cover_url']?$value['cover_url']:"images/img01.jpg")?>"></a>
             <div class="info">
               <p><a href="<?php echo $public_r['newsurl']."tribe/detail/?id=".$value['id'];?>"><?=$value['title']?></a></p>
               <p>圈主：<a href='<?=$public_r['newsurl']?>e/member/sp/?uid=<?=$value[userid]?>'><?=$U['nickname']?></a></p>
               <p><?=mb_substr($value['content'],0,20)?></p>
             </div>
            </li>
           <li>
		  <?php }
		  }else{?>
		<li class='no-data'>暂无数据！</li>
		  <?php }?>          
         </ul>
       </div>
       <div class="bottom"></div>
     </div>
     <div class="content">
       <div class="title"><a class="more" href="<?=$public_r['newsurl']?>act/">+更多</a><h3>精彩回顾</h3></div>
       <div class="body">
<?php if($goodList){
			  foreach($goodList as $gk=>$gv){
				  $U=getUserInfo($gv[userid]);
			  ?>
         <dl class="dl">
            <dd><a href="<?=$public_r['newsurl']?>act/detail/?id=<?php echo $gv[id];?>"><img title="<?=$gv['title']?>" alt="<?=$gv['title']?>" src="<?=$gv[active_cover]?>" width='242'></a></dd>
            <dt><a href="<?=$public_r['newsurl']?>act/detail/?id=<?php echo $gv[id];?>"><?=$gv['title']?></a></dt>
            <dd>
               <p>发 起 人：<a href="<?=$public_r[newsurl]?>e/member/sp/?uid=<?=$gv['userid']?>"><?=$U[nickname]?></a></p>
               <p>活动地点：<?=$gv[address]?></p>
               <p>活动分类：<?=$gv[active_type]?></p>
               <p>活动时间：<?=$gv[start_time]?>至<?=$gv[end_time]?></p>
               <p>关注程度：<?=$gv[onclick]?>人感兴趣</p>
            </dd>
         </dl>
<?php }
				  
			  }else{?>
			  <div class='no-data'>暂无数据！</div>
<?php }?>
       </div>
       <div class="bottom"></div>
     </div>
   </div>
   <div class="clear"></div>
 </div>

 <div class="split"></div>
 <div id="footer">
  <div class="copyright">
    <p><span>&copy;</span> 2011 www.yerenbang.com,all rights reserved</p>
    <p>京ICP备09031272号</p>
  </div>
  <a href="#">关于我们</a>|<a href="#">联系方式</a>|<a href="#">意见反馈</a>|<a href="#">友情链接</a>|<a href="#">网站地图</a>
 </div>
 <div id="bottommain"></div>
</div>
</body>
</html>
